//
//  TitleShowImageTableViewCell.m
//  WuliHanhan
//
//  Created by tang on 16/3/17.
//  Copyright © 2016年 LVpeng. All rights reserved.
//

#import "TitleShowImageTableViewCell.h"
#import "Header.h"


@interface TitleShowImageTableViewCell ()
{
    UIImageView *backIMageView;
}

@end





@implementation TitleShowImageTableViewCell



- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setBackgroundColor:[UIColor clearColor]];
        [self initUI];
    }
    
    return self;
}





- (void)initUI
{
    UIImage *image = image;
    
    image = [UIImage imageNamed:@"tianjia.png"];
    backIMageView = [[UIImageView alloc] initWithFrame:CGRectMake(4, 8, 43, 43)];
//    [backIMageView setBackgroundColor:[UIColor blueColor]];
    [backIMageView setImage:image];
    [self addSubview:backIMageView];
    [backIMageView setUserInteractionEnabled:YES];
    
    
//    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapSelectImage)];
//    [backIMageView addGestureRecognizer:tap];
    
}

//选中图片
- (void)tapSelectImage
{
    //    [backIMageView setImage:[UIImage imageNamed:@"xingzhuangone.png"]];
    [backIMageView.layer setBorderColor:uicolor(255, 204, 0).CGColor];
    [backIMageView.layer setBorderWidth:2.0];
}

- (void)setSelected:(BOOL)selected
{
    //    NSLog(@"222222222222");
    if (selected) {
        //        NSLog(@"玄宗");
        [self tapSelectImage];
    }
    else
    {
        //        NSLog(@"33333");
        [self removeTapSelectImage];
    }
}
//取消选中图片
- (void)removeTapSelectImage
{
    //    [backIMageView setImage:[UIImage imageNamed:@"xingzhuangone.png"]];
    [backIMageView.layer setBorderColor:[UIColor clearColor].CGColor];
    [backIMageView.layer setBorderWidth:2.0];
}
//加载图片
- (void)setImageModelWithDataBase:(UIImage *)imageWithData
{
//    NSLog(@"2222");
    [backIMageView setImage:imageWithData];
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
